package com.wqh.conformity.jwt.domain;

import lombok.Data;

/**
 * @author wqh
 */
@Data
public class Result<T> {

    private Integer code;

    private String message;

    private T data;

    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Result<?> error(Integer code, String message) {
        return new Result<>(code, message);
    }

    public static Result ok() {
        return new Result<>(200, "操作成功");
    }

    public static Result ok(Object data) {
        return new Result<>(200, "操作成功", data);
    }
}
